package com.example.designmodel.chain

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.android.baselibrary.base.BaseActivity
import com.example.designmodel.R
import com.example.designmodel.chain.dialog.DialogChain
import com.example.designmodel.chain.dialog.FirstDialog
import com.example.designmodel.chain.dialog.SecondDialog
import com.example.designmodel.chain.dialog.ThirdDialog
import com.example.designmodel.databinding.ActivityChainMainBinding
import com.example.designmodel.router.DesignRouter

/**
 * 责任链模式
 */

@Route(path = DesignRouter.DESIGN_CHAIN)
class ChainMainActivity : BaseActivity<ActivityChainMainBinding>() {

    override fun getLayoutId(): Int = R.layout.activity_chain_main

    override fun initView() {
    }

    override fun initListener() {
        mBinding.btn.setOnClickListener {
            DialogChain.Builder()
                .addIntercept(FirstDialog(this))
                .addIntercept(SecondDialog(this))
                .addIntercept(ThirdDialog(this))
                .build().proceed()
        }
    }
}